<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue 详情页</title>
</head>
<body>
<div id = "app">
    <h1>{{obj.name}}</h1>
    <time> {{obj.time}}</time>
    <div> {{obj.text}}</div>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.24.0/axios.min.js"></script>


<script>
    new Vue({
        el:"#app",
        data:{
            obj:{

            }
        },
        mounted(){
            //JS获取url参数
            function getQueryVariable(variable)
            {
                var query = window.location.search.substring(1);
                var vars = query.split("&");
                for (var i=0;i<vars.length;i++) {
                    var pair = vars[i].split("=");
                    if(pair[0] == variable){return pair[1];}
                }
                return(false);
            }
            let id = getQueryVariable("id") ;

            axios.get("http://192.168.84.130/Api_demo/Api/post.php?id="+id)
            .then(res=>{
                this.obj = res.data;
            })
        }
    })
</script>
</body>
</html>